Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Getting "InternalError: too much recursion" when retrieving data from Firebase Realtime DB

I'm putting together a component that is supposed to retrieve all users from the DB, which it does - the problem is that it doesn't stop, and retrieves data from the DB endlessly until the app crashes and unsurprisingly gives the error in the title.

Here is the code in question:

const Dashboard = () => {
      const [usersList, setUsersList] = useState([]);
const userRef = query(ref(db, '/Users'));
onValue(userRef, (snapshot) => {
    let userlist = [];
    snapshot.forEach((snap) => {
        userlist.push(snap.toJSON());
    });
    setUsersList(userlist);
    

}, {
    onlyOnce: true
});
return(
    <div>
    {usersList.map(data => {
        return (
                    <div class="profile_info">
                        {data.name}
                    </div>
        );
    })}
    </div>
)
}

To reiterate, it will provide a list of names as expected, but after a few moments it will crash, providing the "InternalError: too much recursion" error. I've done some troubleshooting on my own prior to posting the question and have narrowed it down to the process of sticking all the data in a temporary array and then setting that array into state being responsible, but everything I've seen online about this process seems to point to that being the proper way to do what I'm trying to do, and so I'm feeling stuck.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda